// N1Object.cpp: implementation of the N1Object class.
//
//////////////////////////////////////////////////////////////////////

#include "N1Lib.h"
#include "N1Object.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
N1Object::N1Object() : m_retainCounter(1)
{
}

N1Object::~N1Object() {  }

pcstr N1Object::name() const 
{
    return "N1Object";
}

pcstr N1Object::description() const 
{
    return ((new N1AnsiString("N1Object desctiprion."))
                 ->autorelease<N1AnsiString>())->str();
}
 
N1Object* N1Object::retain() 
{
    m_retainCounter++;
    return this;
}

N1Object* N1Object::release() {
    if( (-- m_retainCounter) <= 0 )
    {
        delete this;
        return NULL;
    }

    return this;
}

N1Object* N1Object::autorelease()
{
    N1AutoreleasePool::add(this);
    return this;
}

N1UInt32 N1Object::retainCounter() const 
{
    return m_retainCounter;
}

bool N1Object::isEqualTo(N1Object *obj)
{
    if (this==obj) return true;
    return false;
}
